﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CoreProject.IRepository;
using CoreProject.IService;
using CoreProject.Model;

namespace CoreProject.Service
{
    public class GoodsService : BaseService<Good>, IGoodsService
    {
        private readonly IGoodsRepository _repository;

        public GoodsService(IGoodsRepository repository) : base(repository)
        {
            this._repository = repository;
        }

        public async Task<(List<Good> list, int count)> GetGoodsBypage(string name, int page, int size)
        {
            return await _repository.GetGoodsBypage(name, page, size);
        }
        public async Task<bool> XiaJia(int gid)
        {
            return await _repository.XiaJia(gid);
        }

        public Task<bool> ShangJia(int gid)
        {
            return _repository.ShangJia(gid);
        }
        public Task<bool> DeleteGood(int id)
        {
            return _repository.DeleteGood(id);
        }

        public Task<bool> DeleteGoods(int[] ids)
        {
            return _repository.DeleteGoods(ids);
        }
        public async Task<bool> UpdateGood(Good good)
        {
            return await _repository.UpdateGood(good);
        }
    }
}
